//
//  StrokeRecordLoader.h
//  StrokeDemo
//
//  Created by wankang on 2/16/15.
//  Copyright (c) 2015 wankang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>

/** loader for StrokeRecord from stroke.db
 */
@interface StrokeRecordLoader : NSObject {
    sqlite3 *mStrokeDB;
    sqlite3 *mGuideDB;
}
@property (nonatomic, setter=setLoadPath:) NSString *loadPath;
@property (nonatomic, setter=setGuidePath:) NSString *guidePath;

-(id)initWithPath:(NSString *)sPath;
-(void)dealloc;
-(void)close;

/** to load stroke record with code and with/without contour/middleLine data
 * @param sCode chn code
 * @param fContour .T. with contour data; .F. without contour data
 * @param fMidLine .T. with middleLine data; .F. without
 * @return NSArray with data in type of StrokeRecord*
 */
-(NSArray *)loadRecordFromCode:(NSString *)sCode withContour:(BOOL)fContour withMidline:(BOOL)fMidline;
/** to load record with utf-8 condition
 * @return NSArray with data in type of StrokeRecord*
 */
-(NSArray *)loadRecordWithCondition:(const char *)sCondition withContour:(BOOL)fContour withMidline:(BOOL)fMidline;
/** to load all possible stroke name, in type of NSString*
 */
-(NSArray *)loadStrokeName;
/** to load guide data, guidePath should not be nil
 * @param sChn code of Chn
 * @param index 0-based stroke index
 * @return NSArray with data in type of NSNumber
 */
-(NSArray *)getChnGuide:(NSString *)sChn withStrokeIndex:(NSInteger)index;
@end
